package com.hclc.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MybatisPlusConfig {

	/**
	 * mybatis-plus分页插件
	 * @param
	 * @return com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor
	 * @author yurj
	 * @mail 1638234804@qq.com
	 * @version 1.0
	 * @date 2020/8/10 10:05
	 */
	@Bean
	public PaginationInterceptor paginationInterceptor() {
		PaginationInterceptor page = new PaginationInterceptor();
		page.setDbType(DbType.MYSQL);
		return page;
	}
	/**
	 * 乐观锁 插件
	 * @return
	 */
	@Bean
	public OptimisticLockerInterceptor optimisticLock() {
		return new OptimisticLockerInterceptor();
	}

}
